import type { FlatGitignoreOptions, default as Ignore } from 'eslint-config-flat-gitignore'
import { FlatConfig } from '../types'
import { interopDefault } from '../utils'

export default async (option?: FlatGitignoreOptions): Promise<FlatConfig[]> => {
  const gitignore = await interopDefault<typeof Ignore>(import('eslint-config-flat-gitignore'))
  return [
    gitignore({
      files: ['.gitignore', '.eslintignore'],
      strict: false,
      ...option,
    }),
  ]
}
